#ifndef CHECK_ROOM_H
#define CHECK_ROOM_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct check_room_t check_room_t;

check_room_t* cr_create();
void cr_destroy(check_room_t* cr);

/* -1: forever */
int cr_wait(check_room_t* cr, int ms);

void cr_notify(check_room_t* cr);

typedef int (*cr_pred_t)(void* param);

int cr_wait_for(check_room_t* cr, cr_pred_t pred, void* param, int ms);

int cr_wait_until(check_room_t* cr, cr_pred_t pred, void* param, uint64_t end_time_ms);

#ifdef __cplusplus
}
#endif

#endif
